#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <iostream>

using namespace std;

class dRational
{
 public:
  int numerator, denominator;
  dRational ();
  dRational (double n);
  dRational (string x);
  dRational (const char *x);
  dRational (int n, int d);
  dRational (const char *n, const char *d);
  dRational (string n, string d);
  ~dRational ();

  // Overloaded operators
  dRational operator+ (const dRational &x);
  dRational operator- (const dRational &x);
  dRational operator* (const dRational &x);
  dRational operator/ (const dRational &x);

  void reduce ();
  char *c_str ();
  string toString ();
};
